package com.herenit.beijing.dh2011.entity;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.Transient;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 *
 * @author Obama
 */
@Entity
@Table(name = "PAT_MASTER_INDEX")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class PatientIndex implements Serializable {

    private static final long serialVersionUID = 1L;
    @TableGenerator(name = "idGenerator",
    table = "ET_Id_Generator",
    pkColumnName = "pkColumn",
    valueColumnName = "valueColumn",
    pkColumnValue = "PatientIndex_id",
    initialValue = 999)
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "idGenerator")
    private long id;
    //患者标识号
    @Column(name = "PATIENT_ID", unique = true)
    private String patientId;
    // 图片
    @Lob
    @Column
    private byte[] photo;
    // 姓名
    @Column(name = "NAME")
    private String name;
    // 性别
    @ManyToOne
    @JoinColumn(name = "SEX_ID")
    private EtConcepts sex;
    // 生日
    @Column(name = "DATE_OF_BIRTH")
    private Timestamp birthday;
    // 民族
    @ManyToOne
    @JoinColumn(name = "NATION_ID")
    private EtConcepts nation;
    // 国籍
    @ManyToOne
    @JoinColumn(name = "NATIONALITY_ID")
    private EtConcepts nationality;
    // 婚姻
    @ManyToOne
    @JoinColumn(name = "MARRIAGE_ID")
    private EtConcepts marriage;
    // 身份证号
    @Column(name = "ID_NO")
    private String identityId;
    // 身份
    @ManyToOne
    @JoinColumn(name = "IDENTITYTYPE_ID")
    private EtConcepts identityType;
    // 出生地
    @Column(name = "BIRTH_PLACE")
    private String birthPlace;
    // 电子邮件
    @Column(name = "EMAIL")
    private String email;
    // 家庭住址
    @Column(name = "MAILING_ADDRESS")
    private String homeAddress;
    // 邮编
    @Column(name = "ZIP_CODE")
    private String zipCode;
    // 家庭电话
    @Column(name = "PHONE_NUMBER_HOME")
    private String telephone;
    // 费别
    @ManyToOne
    @JoinColumn(name = "CHARGETYPE_ID")
    private EtConcepts chargeType;
    // 合同单位
    @Column(name = "UNIT_IN_CONTRACT")
    private String unitInContract;
    // 单位电话
    @Column(name = "PHONE_NUMBER_BUSINESS")
    private String unitTelephone;
    // 联系人姓名
    @Column(name = "NEXT_OF_KIN")
    private String contactName;
    // 联系人关系
    @Column(name = "RELATIONSHIP")
    private String relationship;
    // 联系人地址
    @Column(name = "NEXT_OF_KIN_ADDR")
    private String contactAddress;
    // 联系人邮编
    @Column(name = "NEXT_OF_KIN_ZIP_CODE")
    private String contactZipCode;
    // 联系人电话
    @Column(name = "NEXT_OF_KIN_PHONE")
    private String contactTelephone;
    // 上次住院时间
    @Column(name = "LAST_VISIT_DATE")
    private Timestamp lastVisit;
    // 特殊病人
    @Column(name = "VIP_INDICATOR")
    private boolean vip;
    // 职业
    //@Column(name = "VIP_INDICATOR")
    @Transient
    private EtConcepts occupational;
    @Column(name = "CREATE_DATE")
    private Timestamp createDate;
    @Column(name = "OPERATOR")
    private String creator;
    @Column(name = "UPDATE_DATE")
    private Timestamp updateDate;
    @Column(name = "UPDATER")
    private String updater;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getBirthPlace() {
        return birthPlace;
    }

    public void setBirthPlace(String birthPlace) {
        this.birthPlace = birthPlace;
    }

    public Timestamp getBirthday() {
        return birthday;
    }

    public void setBirthday(Timestamp birthday) {
        this.birthday = birthday;
    }

    public EtConcepts getChargeType() {
        return chargeType;
    }

    public void setChargeType(EtConcepts chargeType) {
        this.chargeType = chargeType;
    }

    public String getContactAddress() {
        return contactAddress;
    }

    public void setContactAddress(String contactAddress) {
        this.contactAddress = contactAddress;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getContactTelephone() {
        return contactTelephone;
    }

    public void setContactTelephone(String contactTelephone) {
        this.contactTelephone = contactTelephone;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getHomeAddress() {
        return homeAddress;
    }

    public void setHomeAddress(String homeAddress) {
        this.homeAddress = homeAddress;
    }

    public String getIdentityId() {
        return identityId;
    }

    public void setIdentityId(String identityId) {
        this.identityId = identityId;
    }

    public EtConcepts getIdentityType() {
        return identityType;
    }

    public void setIdentityType(EtConcepts identityType) {
        this.identityType = identityType;
    }

    public Timestamp getLastVisit() {
        return lastVisit;
    }

    public void setLastVisit(Timestamp lastVisit) {
        this.lastVisit = lastVisit;
    }

    public EtConcepts getMarriage() {
        return marriage;
    }

    public void setMarriage(EtConcepts marriage) {
        this.marriage = marriage;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public EtConcepts getNation() {
        return nation;
    }

    public void setNation(EtConcepts nation) {
        this.nation = nation;
    }

    public EtConcepts getNationality() {
        return nationality;
    }

    public void setNationality(EtConcepts nationality) {
        this.nationality = nationality;
    }

    public String getPatientId() {
        return patientId;
    }

    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }

    public String getRelationship() {
        return relationship;
    }

    public void setRelationship(String relationship) {
        this.relationship = relationship;
    }

    public EtConcepts getSex() {
        return sex;
    }

    public void setSex(EtConcepts sex) {
        this.sex = sex;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getUnitInContract() {
        return unitInContract;
    }

    public void setUnitInContract(String unitInContract) {
        this.unitInContract = unitInContract;
    }

    public String getUnitTelephone() {
        return unitTelephone;
    }

    public void setUnitTelephone(String unitTelephone) {
        this.unitTelephone = unitTelephone;
    }

    public Timestamp getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Timestamp updateDate) {
        this.updateDate = updateDate;
    }

    public boolean isVip() {
        return vip;
    }

    public void setVip(boolean vip) {
        this.vip = vip;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getContactZipCode() {
        return contactZipCode;
    }

    public void setContactZipCode(String contactZipCode) {
        this.contactZipCode = contactZipCode;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) id;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are
        // not set
        if (!(object instanceof PatientIndex)) {
            return false;
        }
        PatientIndex other = (PatientIndex) object;
        if (this.id != other.id) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.herenit.beijing.poc.dh2011.entity.PatientIndex[ id=" + id
                + " ]";
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getUpdater() {
        return updater;
    }

    public void setUpdater(String updater) {
        this.updater = updater;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

    public byte[] getPhoto() {
        return photo;
    }

    public void setPhoto(byte[] photo) {
        this.photo = photo;
    }

    public EtConcepts getOccupational() {
        return occupational;
    }

    public void setOccupational(EtConcepts occupational) {
        this.occupational = occupational;
    }
}
